package com.halixun.d2app.adapter;

import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.halixun.d2app.R;
import com.halixun.d2app.adapter.holder.QingDanViewHolder;
import com.halixun.d2app.base.BaseViewHolder;
import com.halixun.d2app.bean.QingDanInfo;

import java.util.List;

/**
 * @ProjectName: D2App
 * @Package: com.halixun.d2app.adapter
 * @ClassName: QingDanAdapter
 * @Description: java类作用描述
 * @Author: hdx
 * @CreateDate: 2019/12/5 18:29
 * @UpdateUser: hdx
 * @UpdateDate: 2019/12/5 18:29
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class QingDanAdapter extends RecyclerView.Adapter<BaseViewHolder<QingDanInfo>> {

    public List<QingDanInfo> infos;

    public QingDanAdapter(List<QingDanInfo> infos){
        this.infos = infos;
    }

    @NonNull
    @Override
    public BaseViewHolder<QingDanInfo> onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new QingDanViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.qing_dan_item,parent,false));
    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder<QingDanInfo> holder, int position) {
        holder.setLayoutInfo(infos.get(position));
    }

    @Override
    public int getItemCount() {
        return infos.size();
    }
}
